package service1;

import beans1.Mzbean;
import db1.MZDAO;

import java.sql.SQLException;
import java.util.ArrayList;

public class MZService {

    public ArrayList<Mzbean> browse(){
        MZDAO dao =new MZDAO();
        return  dao.getAllRecords();
    }


    public int delMZ(Mzbean user)
    {
        MZDAO userDao=new MZDAO();
        System.out.println("in the delMZ the user.id="+user.getId());
        if(userDao.deleteRecord(user))
            return 1;
        else
            return 2;
    }
    public boolean editMZ(Mzbean user) throws SQLException {
        MZDAO userDao=new MZDAO();
        if(userDao.editMZ(user))
            return true;
        else
            return false;
    }

    public boolean insertMZ(Mzbean user) throws SQLException {
        MZDAO userDao=new MZDAO();
        if(userDao.insertMZ(user))
            return true;
        else
            return false;
    }
}
